<template>
  <div class="box">
    <div >
      <div class="display_flex">
        <div>
          施工片块：
          <el-select v-model="value" placeholder="全部">
            <el-option
              v-for="item in options"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            ></el-option>
          </el-select>
        </div>
        <div>
          开始时间：
          <el-date-picker v-model="value1" type="date" placeholder="选择日期"></el-date-picker>
        </div>
        <div>
          截止时间：
          <el-date-picker v-model="value1" type="date" placeholder="选择日期"></el-date-picker>
        </div>
        <div>
          <el-button type="primary">查询</el-button>
        </div>
      </div>
      <div class="zonghe_table">
        <el-table :data="tableData" style="width: 100%">
          <el-table-column type="index" show-overflow-tooltip label="序号"></el-table-column>
          <el-table-column prop="landName" label="自验地块"></el-table-column>
          <el-table-column prop="place" label="位置"></el-table-column>
          <el-table-column prop="time" label="自验时间"></el-table-column>
          <el-table-column label="操作" fixed="right">
            <!--   -->
            <template slot-scope="scope">
              <el-button size="mini" type="primary" @click="chakanItem(scope.row)">查看</el-button>
            </template>
          </el-table-column>
        </el-table>
      </div>
      <div class="pages">
        <el-pagination
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page="needInfo.page"
          :page-sizes="[10, 20, 30, 40]"
          :page-size="needInfo.size"
          layout="total, sizes, prev, pager, next, jumper"
          :total="total"
        ></el-pagination>
      </div>
    </div>

  </div>
</template>

<script>
import {
  constructingSelfSupervisingInfo,
  constructingSelfSupervisingCheck
} from "@/api/implementationSelfTest";
export default {
  data() {
    return {
      flag: 1,
      options: [
        {
          value: "0",
          label: "全部"
        },
        {
          value: "1",
          label: "莲花村片区片块7-1"
        },
        {
          value: "2",
          label: "莲花村片区片块7-2"
        },
        {
          value: "3",
          label: "莲花村片区片块7-3"
        }
      ],
      value: "",
      value1: "",
      radio: "",
      tableData: [],
      needInfo: {
        page: 1,
        size: 10
      },
      total: 0,
      currentPage4: 4,
      seeImgDialog: false,
      imgArr: [
        { name: "施工自验照片1", path: "" },
        { name: "施工自验照片2", path: "" }
      ],
      title: "",
      textarea: "",
      itemData: "", //单条数据
      ziyanText: "" //自验结论
    };
  },
  mounted() {
    this.getData();
  },
  methods: {
    //查看想
    chakanItem(row) {
      console.log(row,'rwpww')
      this.$router.push({
        path:'/implementationSelfTest/supervisionInformation/detail',
        query:{
          id:row.landId,
          coorDonate:row.coorDonate,
          landName:row.landName,
          villageName:row.villageName,
          time:row.time?row.time:'',
          name:row.name,
          yesOrNo:row.yesOrNo?row.yesOrNo:'',
          opinion:row.opinion
        }
      })
      
    },
    
    getData() {
      var data = {};
      var objArr = this.needInfo;
      for (var index in objArr) {
        if (objArr[index] != "" && objArr[index] != null) {
          data[index] = objArr[index];
        }
      }
      data["projectId"] = localStorage.getItem("projectId");
      constructingSelfSupervisingInfo(data).then(res => {
        console.log(res);
        this.tableData = res.data.rows;
        this.total = res.data.total;
      });
    },
    btnSeeImg(title) {
      this.title = title;
      this.seeImgDialog = true;
    },
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
      this.needInfo.size=val
      this.getData()
    },
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`);
      this.needInfo.page=val
      this.getData()
    }
  }
};
</script>

<style scoped>
* {
  box-sizing: border-box;
}
.box {
  padding: 30px;
}
.display_flex {
  display: flex;
  align-items: center;
}
.display_flex div {
  margin-right: 20px;
  font-size: 14px;
  color: #333;
}
.project_result .display_flex {
  margin: 20px 30px 20px 40px;
}
.project_result .display_flex p {
  font-size: 13px;
  color: #444;
  width: 180px;
}
.project_result .display_flex:first-child p {
  width: 160px;
}
.zonghe_table {
  margin: 20px 0px;
}
.pages {
  text-align: center;
}
.seeImg {
  text-align: center;
}
.landInfo {
  border: 1px solid #efefef;
  box-sizing: border-box;
}
.back {
  margin: 20px;
}
.title_one {
  text-align: center;
  line-height: 40px;
  font-size: 20px;
  color: #444;
  font-weight: bold;
}
.title_little {
  font-size: 13px;
  color: #999;
  margin: 40px 20px 20px 30px;
}
.title .title_little span {
  margin-right: 30px;
}
.project_title {
  background: #f8f8f8;
  height: 50px;
  background: #f8f8f8;
  padding: 0px 30px;
  line-height: 50px;
  color: #48494d;
  font-size: 14px;
  font-weight: bold;
  border-top: 1px solid #efefef;
  border-bottom: 1px solid #efefef;
}
.project_img {
  padding: 30px;
}
</style>